// g++ ioslave.cpp -fPIC -shared -o libioslave.so

#include <userkit.h>
#include "ioslave.h"

bus_diagnostic_info_t diagInfo;

void slave_initialize(){
	bus_diagnostic(diagInfo);
}

int get_slave_size(){
	slavediagnostics slaveInfo = diagInfo.slaves_dia_info;
	return slaveInfo.size();
}

bool whether_normal_slave(int index, int product_code){
	if((diagInfo.slaves_dia_info[index].vendor_id==0x02||diagInfo.slaves_dia_info[index].vendor_id==0x8818)
			&&diagInfo.slaves_dia_info[index].product_code==product_code)
		return true;
	else
		return false;
}

bool whether_iapec_slave(int index, int product_code){
	if(diagInfo.slaves_dia_info[index].vendor_id==0x8818
			&&diagInfo.slaves_dia_info[index].product_code==product_code)
		return true;
	else
		return false;
}
